// ♣♦♥♠在cmd下显示为问号。
// 解决办法：先在cmd中执行chcp 65001将代码页设为utf-8，然后再执行：
// javac -d bin -encoding utf8 Main.java
// java -cp bin -Dfile.encoding=utf8 Main

class Card {
	char category;
	String number;
	
	public Card(char category, String number) {
		this.category = category;
		this.number = number;
	}

	public String toString() {
		return "" + category + number;
	}
}

class Main2 {
	public static void main(String[] args) {

		char categories[] = {'♣', '♦', '♥', '♠'};
		String numbers[] = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};

		Card cards[] = new Card[52];

		for (int i = 0; i < categories.length; i++) {
			for (int j = 0; j < numbers.length; j++) {
				cards[i*numbers.length+j] = new Card(categories[i], numbers[j]);
			}
		}

		System.out.println("洗牌前：");
		printAll(cards);
		Card newCards[] = shuffle(cards);
		System.out.println("洗牌后：");
		printAll(newCards);
	}

	static void printAll(Card cards[]) {
		for (int i = 0; i < cards.length; i++) {
			System.out.println(cards[i]);
			
		}
	}

	static Card[] shuffle(Card cards[]) {
		Card newCards[] = new Card[cards.length];

		int k = 0;
		for (int i = 0; i < cards.length / 2; i++) {
			newCards[k] = cards[i];
			k++;
			newCards[k] = cards[i + cards.length / 2];
			k++;
		}

		return newCards;
	}
}
